package com.zxl.yjb.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zxl.yjb.GlideApp;
import com.zxl.yjb.R;
import com.zxl.yjb.bean.NewsBean;

import java.util.List;

public class NewsAdapter extends BaseQuickAdapter<NewsBean,BaseViewHolder> {

    public NewsAdapter(int layoutResId, @Nullable List<NewsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, NewsBean item) {

        GlideApp.with(mContext).load(item.getImgs().get(0)).into((ImageView) helper.getView(R.id.iv_image));
        helper.setText(R.id.tv_title,item.getTitle());
        helper.setText(R.id.tv_source,item.getSource());
        helper.setText(R.id.tv_end_time,item.getAddtime());
    }
}
